<template>
  <view>
    <u-swipe-action>
      <u-swipe-action-item
        v-for="item in cartList"
        :key="item.goods_id"
        @click="swiperItemClick"
        :options="options"
        :name="item.goods_id"
      >
        <view>{{ item.goods_name }}</view>
      </u-swipe-action-item>
    </u-swipe-action>
  </view>
</template>

<script>
export default {
  data() {
    return {
      cartList: [
        {
          goods_id: 111,
          goods_name: "商品1",
        },
        {
          goods_id: 222,
          goods_name: "商品2",
        },
        {
          goods_id: 333,
          goods_name: "商品3",
        },
      ],
      options: [
        {
          text: "删除",
          style: {
            backgroundColor: "#f56c6c",
          },
        },
      ],
    };
  },
  methods: {
    swiperItemClick(payload) {
      console.log(payload);
    },
  },
};
</script>

<style>
</style>

